package com.jyx.web.socket.session;

import java.util.Collection;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

import javax.websocket.Session;

public class SessionCacheManager {

	private static Map<String,Session> sessionMap = new ConcurrentHashMap<String,Session>();
	
	public Collection<Session> getAll(){
		return sessionMap.values();
	}
	
	public Session get(String id){
		return sessionMap.get(id);
	}
	
	public void put(Session session){
		sessionMap.put(session.getId(), session);
	}
	
	public void remove(String id){
		sessionMap.remove(id);
	}
}
